<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * CodeIgniter
 *
 *
 * @package		CodeIgniter
 * @author		Ramon Moraes
 * @filesource
 */

// ------------------------------------------------------------------------

/**
 * Classe de Sessão
 *
 * @package		CodeIgniter
 * @subpackage	Libraries
 * @category	Sessions
 * @author		Ramon Moraes
 */
class Sessao {
	
	public function __construct(){
		session_start();
	}
	
	public function set_userdata($key, $value){
		
		$_SESSION[$key] = $value;
	}
	
	public function userdata($key, $bool=false){
		
		if(isset($_SESSION[$key])){
			return $_SESSION[$key]; 
		}
		
		if($bool){
			return false;
		}
		
		return null;
	}
	
	public function unset_userdata($key){
		
		unset($_SESSION[$key]);
	}
}